﻿
using Medallion.Threading;
using Medallion.Threading.WaitHandles;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DistributedLocking;
using Volo.Abp.Modularity;
using Volo.Abp.Settings;
using Volo.Abp.Timing;

namespace Acme.Abp.SerialNumberGenerator;

[DependsOn(typeof(AbpSettingsModule))]
[DependsOn(typeof(AbpDistributedLockingModule))]
[DependsOn(typeof(AbpTimingModule))]
public class SerialNumberGeneratorModule: AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var configuration = context.Services.GetConfiguration();
        
        context.Services.AddSingleton<IDistributedLockProvider>(sp => new WaitHandleDistributedSynchronizationProvider());
    }
}